//
//  DatabaseConnection.h

//

#import <Foundation/Foundation.h>

@class AppDelegate;
@class Items;
@class Photo;

@interface DatabaseConnection : NSObject 

#pragma mark - CMC structure

//+ (NSMutableArray*)readAllItemsFromEntity:(NSString*)entityName sortWithKey:(NSString*)key ascending:(BOOL)ascending;

//+ (NSMutableArray*)readItemsFromEntity:(NSString*)entityName withConditionString:(NSString*)condition sortWithKey:(NSString*)key ascending:(BOOL)ascending;

//+ (BOOL)writeAnItem:(Items*)item ToEntity:(NSString*)entityName Immediatly:(BOOL)now;

+ (void)writeListItems:(NSMutableArray*)list toEntity:(NSString*)entityName withPrimaryKey:(NSString*)primaryKey;

+ (void)deleteListItems:(NSMutableArray*)list fromEntity:(NSString*)entityName withPrimaryKey:(NSString*)primaryKey;


//+ (BOOL)updateAnItem:(Items*)item ToManagedItem:(NSManagedObject*)managedItem Immediatly:(BOOL)now;

#pragma mark - App Structure
+ (NSMutableArray*)getDefaultCategories;

+ (NSMutableArray *)getCategories;

+ (NSMutableArray *)getRecentlyUsedPhotos;

+ (NSMutableArray *)getRecentlyAddedPhotos;

+ (NSMutableArray *)getTumblrPhotosWithTag:(NSString*)_tag;

+ (NSMutableArray *)getFavoritePhotos;

+ (NSMutableArray *)getFavoritePhotoWithID:(NSString*)_photoID;

+ (BOOL)isAddedToFavoriteWithPhotoID:(NSString*)_photoID;

+ (NSMutableArray *)getCustomsPhotos;

+(BOOL)writeToCustomPhotoWithImage:(UIImage*)_image;
+(BOOL)updateToCustomPhoto:(Photo*)photo
                 withImage:(UIImage*)_image;


+ (NSInteger)updateListPhotos:(NSMutableArray*)listPhoto;


@end
